package org.scau.studentevaluation.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.scau.studentevaluation.config.global.log.WebLog;
import org.scau.studentevaluation.entity.Appeal;
import org.scau.studentevaluation.entity.ExamAct;
import org.scau.studentevaluation.entity.ExamOtherAct;
import org.scau.studentevaluation.entity.Examin;
import org.scau.studentevaluation.service.IExamServicePart1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by Winter on 2020/8/26.
 */
@Slf4j
@RestController
@Api("Exam控制器")
@WebLog("Exam控制器")
public class ExamPart1Controller {
    @Autowired
   private IExamServicePart1 examService;

//    @PutMapping("/hello")
    @GetMapping("/hello")
    @ApiOperation("获取社团数据")
    public List<ExamAct> hello(@RequestParam(value = "userName",required = false) String userName) {
        return examService.hello(userName);
    }
    // lyl:修改为PostMapping才能接受@RequestBody
    @PostMapping("/exam")
    public int examin(@RequestBody Examin examin){
//        examService.exam(examin);

        return examService.examin(examin);
    }

    @DeleteMapping("/delete")
    public int deleteAct( String college,String from,int id) {
        return examService.deleteAct(college,from,id);
    }

    @GetMapping("/helloOther")
    public List<ExamOtherAct> helloOther(String college){
        return examService.helloOther(college);
    }

    @PutMapping("/appeal")
    public int getAppeal(Appeal appeal){
        return 1;
    }
}
